package com.szholly.pro.watergas_server.ps.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.szholly.pro.watergas_server.common.data.DataUtil;
import com.szholly.pro.watergas_server.common.web.BaseController;
import com.szholly.pro.watergas_server.common.web.RequestUnit;
import com.szholly.pro.watergas_server.ps.service.DomainService;
import com.szholly.pro.watergas_server.ps.service.SiteExamineService;
import com.szholly.data.general.RowBase;
import com.szholly.plug.form.excel.utils.StringUtil;

@Controller
@RequestMapping("/SiteExamine/*")
public class SiteExamineController extends BaseController { 
	
	@Autowired
	DomainService domainService;
	
	@Autowired
	SiteExamineService siteExamineService; 
	
	@RequestMapping(value = "/getSiteExamineList")
	public void getSiteExamineList(HttpServletRequest resq, HttpServletResponse res) throws Exception {
		Map<String,String> map = new HashMap<String,String>();
		
		String wwtp_id = RequestUnit.getParameter("WWTP_ID");
		if (StringUtil.IsNotNullOrEmpty(wwtp_id)) {
			map.put("wwtp_id", wwtp_id);
		}
		String flow_type = RequestUnit.getParameter("FLOW_TYPE");
		if (StringUtil.IsNotNullOrEmpty(flow_type)) {
			map.put("flow_type", flow_type);
		}
		String station_id = RequestUnit.getParameter("STATION_ID");
		if (StringUtil.IsNotNullOrEmpty(station_id)) {
			map.put("station_id", station_id);
		}
		String water_type = RequestUnit.getParameter("WATER_TYPE");
		if (StringUtil.IsNotNullOrEmpty(water_type)) {
			map.put("water_type", water_type);
		}
		String group_id = RequestUnit.getParameter("GROUP_ID");
		if (StringUtil.IsNotNullOrEmpty(group_id)) {
			map.put("group_id", group_id);
		}
		String operator = RequestUnit.getParameter("OPERATORS");
		if (StringUtil.IsNotNullOrEmpty(operator)) {
			map.put("operator", operator);
		}
		String start = RequestUnit.getParameter("start");
		if (StringUtil.IsNotNullOrEmpty(start)) {
			map.put("start", start);
		}
		String end = RequestUnit.getParameter("end");
		if (StringUtil.IsNotNullOrEmpty(end)) {
			map.put("end", end);
		}
		
		List<RowBase> list = siteExamineService.getSiteExamineList(map, DataUtil.getPageInfo());
		String result = DataUtil.listToJSONObject(list).toString();
		outString(result);
	}
}
